import { onScopeDispose } from 'vue'
import bus from '@/libs/bus'

const deleteRulerLineEventName = 'delete-ruler-line'

// 发送删除量尺线事件
export const emitDeleteRulerLineEvent = data => {
    bus.emit(deleteRulerLineEventName, data)
}

// 接收删除量尺线事件
export const onDeleteRulerLineEvent = callback => {
    bus.on(deleteRulerLineEventName, callback)
    
    onScopeDispose(() => {
        bus.off(deleteRulerLineEventName, callback)
    })
}
